<?xml version='1.0' encoding='UTF-8' ?>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<f:view encoding="ISO-8859-1">
	<h:head>
		<title>Relatório de vendas</title>
		<h:outputStylesheet library="css" name="styles.css" />
		<h:outputScript library="js" name="scripts.js" />
	</h:head>
	<h:body>
		<h:form id="frmSaleReport" styleClass="frm"
			rendered="#{loginBean.isLogged() and loginBean.hasPermission('CadGeneral')}">
			
			<ui:include src="../../templates/menu.xhtml" />
			
			<p:growl id="messages" showDetail="true" sticky="true"/>
				
			<p:panel id="panelReport" header="Relatório de vendas">
					<h:outputLabel id="lblStartDate" value="Data inicial: "
						styleClass="outPutLabel" />
					<p:calendar id="calStartDate" locale="pt_BR" showButtonPanel="true" navigator="true" label="Data inicial"
						value="#{reportBean.startDate}" pattern="dd/MM/yyyy"/>
						
					<h:outputLabel id="lblEndDate" value="Data final: "
						styleClass="outPutLabel" />
					<p:calendar id="calEndDate" locale="pt_BR" showButtonPanel="true" navigator="true" label="Data final"
						value="#{reportBean.endDate}" pattern="dd/MM/yyyy" mindate="#{reportBean.startDate}"/>
					
					<p:commandButton id="cmdReport" value="Gerar relatório" actionListener="#{reportBean.onReportClick}"
						icon="ui-icon-note" update=":frmSaleReport:lcSale"/>
			</p:panel>
			<p:panel>
			
				<p:lineChart id="lcSale" value="#{reportBean.saleChartModel}" legendPosition="e"
					title="Vendas do período" minY="0" maxY="400" style="height:300px;margin-top:20px"/>
			
			</p:panel>
		</h:form>
		<h:form	rendered="#{!loginBean.isLogged() or !loginBean.hasPermission('CadGeneral')}">
			<h1 align="center">
				<h:outputText value="Acesso não autorizado a esta página!" />
			</h1>
			<h1 align="center">
				<h:graphicImage value="#{resource['images/general/forbidden.png']}" />
			</h1>
		</h:form>
		<ui:include src="../../templates/footer.xhtml" />
	</h:body>
</f:view>
</html>